/**
 * 
 */
package src.sil4.model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author KingJackson
 *
 */
public class GestionFactory {
	
	private static final List<Etudiant> listEtudiants = Arrays.asList(
			new Etudiant(0, "Francis", "Brunet-Manquat", 0, 15,"MIAM"),
			new Etudiant(1, "Philippe", "Martin", 7, 13,"MIAM"),
			new Etudiant(2, "Mario", "Cortes-Cornax",0, 2, "MIAM"),
			new Etudiant(3, "Françoise", "Coat", 0, 6,"SIMO"),
			new Etudiant(4, "Laurent", "Bonnaud", 0, 12,"MESSI"),
			new Etudiant(5, "S�bastien", "Bourdon",0, 18, "MESSI"),
			new Etudiant(6, "Mathieu", "Gatumel", 0, 17,"SIMO")
			);
	
	public static List<String> getGroups (){
		ArrayList<String> list = new ArrayList<String>();
		list.add("MESSI");
		list.add("SIMO");
		list.add("MIAM");
		return list;
	}
	
	public static List<Etudiant> getEtudiantsParGroupe(String groupe) {
		ArrayList<Etudiant> listEtudiants = new ArrayList<Etudiant>(GestionFactory.getEtudiants());
		ArrayList<Etudiant> listEtudiantsParGroupe = new ArrayList<Etudiant>();
		
		if(groupe.equals("all")){
			return listEtudiants;
		}
		else{
			for (Etudiant etudiant : GestionFactory.getEtudiants()) {
				if (etudiant.getGroupe().equals(groupe)) {
					listEtudiantsParGroupe.add(etudiant);
				}
			}
			return listEtudiantsParGroupe;
		}
	}
	
	// Retourne l'ensemble des etudiants
	public static List<Etudiant> getEtudiants() {
		return listEtudiants;
	}
	
	
	public static String testSelected (String groupeChoisit,String val) {
		if(groupeChoisit.equals(val)) {
			return "selected";	
		}
		return "";
	}


}
